import java.security.PublicKey;
import java.util.concurrent.Callable;

public class Test {
    public static void main(String[] args) {
       /* OuterClass outerClass = new OuterClass();*/
       /* OuterClass.InnerClass innerClass = new OuterClass().new InnerClass();
        OuterClass.InnerClass innerClass2 = outerClass.new InnerClass();
        innerClass.test();*/


        /*OuterClass.Innerclass2 innerclass2 = new OuterClass.Innerclass2();
        innerclass2.test();*/
/*
        Comparable<Student> comparable = new Student();//接口向上转型

        new Comparable<Student>(){
            ////一个类实现了接口，重写了方法
            @Override
            public int compareTo(Student o) {
                return 0;
            }
        };*/

        int a = 10;
        new Shape(){
            @Override
            public void draw() {
                //a = 99;//在匿名内部类当中，访问的变量是不可以改变的
                System.out.println("矩形"+a);
            }
        }.draw();



    }
}


interface Shape{
    void draw();
}
//匿名内部类
//一个类实现了接口，重写了方法
class Student implements Comparable<Student>{

    @Override
    public int compareTo(Student o) {
        return 0;
    }
}


class OuterClass{
    public int data1 = 10;
    private int data2 = 20;
    private static  int data3 = 30;


    //静态内部类
    /*static class Innerclass2{
        public int data11 = 10;
        private int data12 = 20;
        private static int data13 = 30;

        public void test(){
            //1.如何实例化静态内部类对象
            //2.如何在静态内部类当中访问外部类的非静态成员
            System.out.println("test3()");
            OuterClass outerClass = new OuterClass();
            System.out.println(outerClass.data1);
            System.out.println(data11);
        }
*/
    /*}*/

   //局部内部类
   /* public void test(){
        class Inner{
            public int data01 = 10;
        }
       Inner inner =new Inner();//之间进行实例化
        System.out.println(inner.data01);

    }*/



    /*public void test2(){
        InnerClass innerClass = new InnerClass();
        System.out.println(innerClass.data1);
    }
*/




    //实例内部类/
    //类里面，方法外面
    //1.如何实例化，实例内部类对象
    //2.在实例内部类当中不能定义静态的成员变量
    /*class InnerClass{
        public int data1 = 111;
        public int data4 = 20;
        private static final int data5 =20;*/
        //final修饰的是常量，在编译的时候就已确定
        //static不依赖对象，但实例内部类对象依赖对象

       /* public void test2(){
            System.out.println("test");
            //实例内部类，是存在外部类的this的
            System.out.println(OuterClass.this.data1);
            System.out.println(data2);

        }*/
}


